<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-wowInfo-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">证件号码：</label>
				<div class="col-sm-8">
					<input id="empId" name="empId" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">姓名：</label>
				<div class="col-sm-8">
					<input id="empNm" name="empNm" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">加班日期：</label>
				<div class="col-sm-8">
					<input type="text" class="time-input form-control" id="wowDt" name="wowDt"/>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">加班事由：</label>
				<div class="col-sm-8">
					<input id="wowDsc" name="wowDsc" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">加班类型：</label>
				<div class="col-sm-8">
					<select id="wowType" class="form-control m-b" th:with="type=${@dict.getType('pm_wow_type')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">加班小时数：</label>
				<div class="col-sm-8">
					<input id="wowHours" name="wowHours" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">OA流程标题：</label>
				<div class="col-sm-8">
					<input id="wowOaInfo" name="wowOaInfo" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "pm/wowInfo";
		$("#form-wowInfo-add").validate({
			rules:{
				empId:{
        			required:true
        		},
        		empNm:{
        			required:true
        		}
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	add();
	        }
	    }
		
		layui.use('laydate', function(){
			var laydate = layui.laydate;
			laydate.render({
				elem: '#wowDt',
				theme: 'default',
		        trigger: 'click'
			});
		});
		
		function add() {
			var empId = $("input[name='empId']").val();
        	var empNm = $("input[name='empNm']").val();
        	var wowDt = $("#wowDt").val();
        	var wowDsc = $("input[name='wowDsc']").val();
        	var wowType = $("#wowType option:selected").val();
        	var wowHours = $("input[name='wowHours']").val();
        	var wowOaInfo = $("input[name='wowOaInfo']").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "pm/wowInfo/add",
        		data : {
        			"empId": empId,
        			"empNm": empNm,
        			"wowDt": wowDt,
        			"wowDsc": wowDsc,
        			"wowType": wowType,
        			"wowHours": wowHours,
        			"wowOaInfo": wowOaInfo
        		},
        		async : true,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }
	</script>
</body>
</html>
